package com.fun.demo.thread;

import com.fun.demo.fun.Hello;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class CpuManager {

    public static void main(String[] args) throws InterruptedException, UnsupportedEncodingException {
//        //控制cpu
//        long busyTime = 10;
//        Thread th = Thread.currentThread();
//        long nowSys = 0;
//        while(true){
//            nowSys = System.currentTimeMillis();
//            while((System.currentTimeMillis()-nowSys)<=busyTime){
//                System.out.println(1);
//            }
//            th.sleep(7);
//        }

//        Hello hello = new Hello();
//        System.out.println(hello.toString());
//       Thread curthd =  Thread.currentThread();
//       ClassLoader classLoader = curthd.getContextClassLoader();
//        try {
//           Class<?> cls =  classLoader.loadClass("com.fun.demo.fun.Hello");
//          boolean b =  cls.getClassLoader() == classLoader;
//          Hello hello1 = (Hello) cls.newInstance();
//            System.out.println(hello1.toString());
//        } catch (ClassNotFoundException e) {
//            e.printStackTrace();
//        } catch (IllegalAccessException e) {
//            e.printStackTrace();
//        } catch (InstantiationException e) {
//            e.printStackTrace();
//        }
        String url = "t=吃饭&a=hua>*|~^shui";


        System.out.println(URLEncoder.encode(url, "UTF-8"));



    }

}
